﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RozesilaniNovinek
{
    public partial class SpravaZakaznika : Form
    {
        KolekceObserveru kolekceObserveru = new KolekceObserveru();

        SMS sms = new SMS();
        Email email = new Email();
        Posta posta = new Posta();

        public SpravaZakaznika()
        {
            InitializeComponent();
        }

        private void btn_Test_Click(object sender, EventArgs e)
        {
            kolekceObserveru.Novinka = new Novinka()
            {
                Nazev = "Testovací novinka",
                Popis = "Popis testovací novinky.",
                Datum = DateTime.Now
            };
        }

        private void chb_SMS_CheckedChanged(object sender, EventArgs e)
        {
            if (chb_SMS.Checked)
                kolekceObserveru.PrihlasObserver(sms);
            else
                kolekceObserveru.OdhlasObserver(sms);
        }

        private void chb_Email_CheckedChanged(object sender, EventArgs e)
        {
            if (chb_Email.Checked)
                kolekceObserveru.PrihlasObserver(email);
            else
                kolekceObserveru.OdhlasObserver(email);
        }

        private void chb_Posta_CheckedChanged(object sender, EventArgs e)
        {
            if (chb_Posta.Checked)
                kolekceObserveru.PrihlasObserver(posta);
            else
                kolekceObserveru.OdhlasObserver(posta);
        }
    }
}
